package HeSuanServer.uitl;

import HeSuanServer.POJO.UserMessage;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * @描述:
 * @author: LH
 * @date: 2022/12/27
 */
public class StatusUtil {
    public static List<UserMessage> setStatus(List<UserMessage> list){
        for (UserMessage userMessage : list) {
            Date date = userMessage.getDate();
            SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            String format1 = format.format(date);
            userMessage.setDateString(format1);
            if (userMessage.getResult().equals("0")){
                userMessage.setResult("检测中");
                continue;
            }
            if (userMessage.getResult().equals("1")){
                userMessage.setResult("阴性");
                continue;
            }
            if (userMessage.getResult().equals("2")){
                userMessage.setResult("阳性");
            }
        }
        return list;
    }
    public static UserMessage setR(UserMessage message){
        String result = message.getResult();
        if (result.equals("0")){
            message.setResult("检测中");
        }
        if (result.equals("1")){
            message.setResult("阴性");
        }
        if (result.equals("2")){
            message.setResult("阳性");
        }
        return message;
    }
}
